<script>
import appConfig from "./utils/appConfig";
import config from "./utils/config.js";
export default {
  globalData: {
	host:config.host1,
    isLogin: false,
    version: config.version,
    subscribeTemplate: [], //消息订阅模板
    isSubscribe: false, //是否打开了消息订阅总开关
	location:{},
	bluedata:{}
  },
  onLaunch: function () {
    // 公共方法移至 appConfig 中
    appConfig();
	// uni.setInnerAudioOption({
 //        obeyMuteSwitch: false
 //    });
	// #ifdef APP-PLUS
	  // 客户端获取push客户端标记
	  uni.getPushClientId({
	    success: async (res) => {
	      let push_clientid = res.cid
	      //这个id是不会改变的，我们需要在登录必经过的页面或者方法拿到这个id传给后端存储起来
	      uni.setStorageSync('unipush_id', push_clientid)
		  console.log('推送id:', push_clientid)
	    },
	    fail(err) {
	      console.log('推送id获取失败:', err)
	    },
	  })
	  
	  // //离线推送-点击信息
	  // plus.push.addEventListener(
	  //   'click',
	  //   async function (msg) {
	  //     setTimeout(function () {
	  //       uni.navigateTo({
	  //         url: `/${msg.payload['path']}`,
	  //       })
	  //     }, 1000)
	  //     plus.push.clear()
	  //   },
	  //   false
	  // )
	  // // 在线推送-接收信息
	  // plus.push.addEventListener(
	  //   'receive',
	  //   function (msg) {
	  //   //ios平台需要多一层判断，且拿取方式不同
	  //     var platform = uni.getSystemInfoSync().platform
	  //     if (platform == 'ios') {
	  //       if (msg.type == 'receive') {
	  //         // 这里判断触发的来源，否则一直推送。
	  //         let options = { cover: false, title: msg.payload.title }
	  //         plus.push.createMessage(msg.content, msg.payload.path, options)
	  //       }
	  //     } else if (platform == 'android') {
	  //       let option = { cover: false, title: msg.title }
	  //       plus.push.createMessage(msg.content, msg.payload.path, option)
	  //     }
	  //   },
	  //   false
	  // )
	
	  // 在线推送-点击信息
	  uni.onPushMessage(async (res) => {
		if (res.type === 'receive') {
			uni.createPushMessage({
				title: res.data.title,
				content: res.data.content,
				payload: res.data.payload,
				// sound: "system",
				cover: false
			})
		} else if (res.type === 'click') {
			// click 点击状态栏的消息时,进行跳转页面
			console.log(res);
			  // plus.push.clear()
			  // plus.runtime.setBadgeNumber(-1) //清除图标右上角数字
			if(res.data.payload){
				if(res.data.payload.includes('music')){
					uni.reLaunch({
						url: res.data.payload
					})
				}else{
					uni.navigateTo({
						url: res.data.payload
					})
					
				}
			}else{
				uni.switchTab({
					url:'/pages/tabbar/health/index'
				})
				
			}
			
		}
	    // if (res.type === 'click') {
	    //   setTimeout(function () {
	    //     uni.navigateTo({
	    //       url: `/${data}`,
	    //     })
	    //   }, 1000)
	    //   plus.push.clear()
	    //   plus.runtime.setBadgeNumber(0) //清除图标右上角数字
	    // }
	  })
	 //  uni.onPushMessage((res) => {
		// 	console.log("收到推送消息：",res) //监听推送消息
		// 	if(res.data){
		// 		console.log(res.data)
		// 		// uni.createPushMessage(res.data)  //收到消息推送，创建系统状态栏及锁屏通 知
		// 	}
		// })
	  // #endif



    // uni.$_removeToken();
  },
  onShow: function () {
	  
    console.log("App Show");
  },
  onHide: function () {
    console.log("App Hide");
	
  },
};
</script>
<style lang="scss">
@import "uview-ui/index.scss";

//checkbox-多选样式
.signup-content {
  /deep/.u-checkbox {
    .u-checkbox__label {
      width: 100% !important;
      margin-right: 0 !important;
    }
  }
}
/deep/uni-tabbar .uni-tabbar__icon{
	// margin-top: -5px;
	// margin-bottom: 2px;
}
/deep/uni-tabbar .uni-tabbar__icon img{
	height: auto;
}
/deep/uni-tabbar .uni-tabbar-border{
	background-color: rgba(0,0,0,0.15) !important;
}
table{
	width: 100% !important;
	 border-collapse: collapse;
}
table, th, td {
  border: 1px solid #ccc;; /* 设置表格、表头、单元格的边框 */
  border-right-color: #ccc !important;;
  border-bottom-color: #ccc !important;;
  border-left-color:#ccc !important;
}
.textC{
	line-height: 44rpx;
	font-size: 26rpx;
	color: #333;
	p{
		img{
			max-width: 100%;
			width: auto;
			height: auto;
			display: inline-block;
		}
	}
}
.navNone{
	display: none;
}
/deep/.u-drawer-content-visible.u-drawer-center{
	z-index: 998 !important;
}
/deep/.u-drawer{
	z-index: 997 !important;
}/deep/.u-mask-zoom{
	z-index: 996 !important;
}
/deep/.u-back-wrap{
	padding-right: 40rpx;
}
/deep/.u-icon-wrap{
	padding-left: 0;
}
page {
	overflow-x: hidden;
	font-family: $uni-font-family-Medium;
}
.content{
	padding: 0 30rpx;
}
.hover{
	background-color: #F2F6FE;
	border-radius: 4rpx;
}
/deep/.u-btn--primary{
	background-color: #6387FF !important;
	border-color: #6387FF !important;
}
.chart-active{
	.chart {
		width: 100%;
		padding: 0 10rpx 0 0;
		box-sizing: border-box;
		height: 600rpx;
		margin-top: -40rpx;
		margin-bottom: 20rpx;
		position: relative;
		.img{
			width: 350rpx;
			height: 350rpx;
			position: absolute;
			top: 45%;
			left: 50%;
			transform: translate(-50%,-50%);
			z-index: 2;
			image{
				width: 100%;
				height: 100%;
			}
			.txt{
				font-size: 28rpx;
				color: #ccc;
				text-align: center;
			}
		}
		
	}
}
.chart-box {
	background: #ffffff;
	border-radius: 24rpx;
	box-shadow: 0rpx 0rpx 20rpx 0rpx rgba(0,0,0,0.08); 
	padding: 30rpx 0 10rpx;
	margin-bottom: 30rpx;
	// padding: 0 30rpx;
	.title {
		height: 90rpx;
		align-items: baseline;
		margin-bottom: 10rpx;
		padding-left: 20rpx;
		image {
			width: 50rpx;
			height: 50rpx;
			margin: 10rpx 15rpx 0 0;
		}
	}

	.num {
		font-size: 68rpx;
		font-family: $uni-font-family-Bold;
		color: #000;
	}

	.dw {
		font-size: 24rpx;
		font-family: $uni-font-family-Medium;
		color: #000;
		margin-left: 10rpx;
	}

	.time {
		font-size: 24rpx;
		font-family: $uni-font-family-Medium;
		color: #8F8F8F;
		margin-left: 10px;
	}

	.chart {
		width: 100%;
		padding: 0 10rpx 0 0;
		box-sizing: border-box;
		height: 600rpx;
		margin-top: -80rpx;
		margin-bottom: 20rpx;
		position: relative;
		.img{
			width: 350rpx;
			height: 350rpx;
			position: absolute;
			top: 45%;
			left: 50%;
			transform: translate(-50%,-50%);
			z-index: 2;
			image{
				width: 100%;
				height: 100%;
			}
			.txt{
				font-size: 28rpx;
				color: #ccc;
				text-align: center;
			}
		}
		
	}
}
</style>
<style src="./static/css/index.min.css"></style>
<style src="./static/css/common.css"></style>
<style lang="scss" src="./static/css/index.scss"></style>
